package com.yuanfeng.service.impl;

import java.io.Serializable;
import java.util.List;

import com.yuanfeng.dao.IDepartmentDao;
import com.yuanfeng.pojo.Department;
import com.yuanfeng.service.IDepartmentService;

// Service接口实现
public class DepartmentService implements IDepartmentService {

	// 注入dao
	private IDepartmentDao departmentDao;
	public void setDepartmentDao(IDepartmentDao departmentDao) {
		this.departmentDao = departmentDao;
	}
	
	// 事务控制是在Service的方法上
	public void save(Department department) {
		departmentDao.save(department);
	}
	
	public Department findById(Serializable id) {
		return departmentDao.findById(id);
	}

	@Override
	public void delete(Serializable id) {
		departmentDao.delete(id);
	}

	@Override
	public List<Department> getAll() {
		return departmentDao.getAll();
	}

	@Override
	public void update(Department department) {
		departmentDao.update(department);
	}

}
